<?php $this->load->view('home/layout/header'); ?>
    <div class="widthMax vote-bzezt">
        <a href="<?php echo site_url(); ?>" class="go-bzezt">
            <p>进入首页</p>
        </a>
        <div class="am-tabs" data-am-tabs="{noSwipe: 1}">
            <ul class="vote-head am-tabs-nav flex">
                <li class="flex-1">
                    <a href="#tab1">
                        <p>活动概况</p>
                    </a>
                </li>
                <li class="flex-1 am-active">
                    <a href="#tab2">
                        <p>我要投票</p>
                    </a>
                </li>
            </ul>
            <div class="vote-text am-tabs-bd">
				<div class="return-index" >
                    <a href="javascript:history.back();"> <i class="iconfont icon-zuojiantou"></i></a></div>
                <div class="am-tab-panel" id="tab1">
                    <div class="select-img">
                        <img src="/skins/home/images/vote.jpg" />
                    </div>
                    <div class="select-ltrb">
                        <div class="select-test">
                            <p>过年啦，走亲访友？家用招待？我的年货我作主？这个春节，你想要什么年货呢？从1月13日到21日，升级版“金牌年货”评选再次来袭，届时根据投票结果评选出“<span>最受欢迎年货、最佳招待年货、最放心年货</span>”等单品年货奖项，在2016新春年货给力降价，敬请关注！</p>
                            <i class="text-lt iconfont">&#xe62c;</i>
                            <i class="text-rt iconfont">&#xe62c;</i>
                            <i class="text-rb iconfont">&#xe62c;</i>
                            <i class="text-lb iconfont">&#xe62c;</i>
                        </div>
                    </div>
                    <div class="selection">
                        <div class="select-vote">
                            <ul class="am-cf">
                                <li class="select">投票评选</li>
                                <li class="result">统计结果</li>
                                <li class="sales">公布奖项</li>
                            </ul>
                        </div>
                        <div  class="select-plan am-cf">
                            <div class="round am-fl"></div>
                            <div class="stripes am-fl"></div>
                            <div class="round1 am-fl"></div>
                            <div class="stripes1 am-fl"></div>
                            <div class="round1 am-fl"></div>
                        </div>
                        <div class="active-rules">
                            <p><i class="iconfont">&#xe629;</i><span class="title">活动规则</span></p>
                            <p class="content">本次评选活动,参与者每天可对自己最想购买的年货进行一次投票，每次投票每类至少选一项</p>
                        </div>
                        <div class="active-time">
                            <p><i class="iconfont">&#xe62a;</i><span class="title">活动时间</span></p>
                            <p class="content"><?php echo date('Y年m月d日', strtotime($vote->start_date)), '至', date('Y年m月d日', strtotime($vote->end_date)); ?></p>
                        </div>
                        <div class="select-result">
                            <p><i class="iconfont">&#xe629;</i><span class="title">评选结果公开销售处</span></p>
                            <div class="am-cf">
                                <span class="result-num">1</span>
                                <div class="content">登录<a href="<?php echo site_url(); ?>">wap.zxkj918.com</a>平台网站购买。</div>
                            </div>

                            <div>
                                <span class="result-num">2</span>
                                <div class="content">扫一扫各合作媒体微信号购买。</div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="am-tab-panel am-in am-active" id="tab2">
                    <div class="vote-ing">
                        <img src="/skins/home/images/vote.jpg">
                        <div class="vote-img2">
                            <img src="/skins/home/images/vote-2.png">
                        </div>
                        <div class="vote-advert">
                            <?php echo $vote->describe; ?>
                            <form id="vote-form" action="<?php echo site_url('home/vote/votePost'); ?>" method="post">
                                <input type="hidden" name="option_id">
                                <input type="hidden" name="unfounder" value="<?php echo $this->input->get('unfounder'); ?>">
                                <input type="hidden" name="vote_id" value="<?php echo $voteId; ?>">
                                <?php foreach( $voteTopic as $it=>$item ) : ?>
                                    <dl class="vote-label">
                                        <dt class="flex">
                                            <i class="vote-icon"></i>
                                        <p class="flex-1"><?php echo $item['title']; ?></p>
                                        </dt>
                                        <?php $pageNum = count($item['optionList']) - 1;
                                        $percentageTotal = 0;
                                        ?>

                                        <?php foreach( $item['optionList'] as $key=>$value ) : ?>
                                            <?php $percentage = ($value->count > 0) ? bcmul(bcdiv($value->count, $item['voteTotal'], 2), 100) : 0;?>
                                            <?php if ( $key == $pageNum && $percentage > 0 ) :  ?>
                                                <?php $percentage = 100 - $percentageTotal ?>
                                            <?php else : ?>
                                                <?php $percentageTotal += $percentage;?>
                                            <?php endif ?>
                                            <dd>
                                                <div class="vote-scroll flex-1">
                                                    <p><?php echo $value->option_name; ?></p>
                                                    <div class="vote-case">
                                                        <div class="vote-percentum" style="width:<?php echo $percentage; ?>%" data-am-scrollspy="{animation: 'slide-left',repeat: false}"></div>
                                                    </div>
                                                </div>
                                                <div class="vote-choice <?php echo  $value->type == 1 ? 'vote-single-selection' : 'vote-multi-select';?>">
                                                    <div class="vote-frame">
                                                        <i class="iconfont">&#xe62b;</i>
                                                        <input type="checkbox" name="vote" data-name="<?php echo $value->option_name;?>" value="<?php echo $value->id; ?>">
                                                    </div>
                                                    <div class="vote-ticket flex">
                                                        <span class="flex-1"><?php echo $value->count; ?>票</span>
                                                        <p>
                                                            <?php echo $percentage; ?>%
                                                        </p>
                                                    </div>
                                                </div>
                                            </dd>
                                        <?php endforeach; ?>
                                    </dl>
                                <?php endforeach; ?>
                                <div class="vote-submit">
                                <?php $today = date('Y-m-d H:i:s'); ?>
                                <?php if ( $today < $vote->start_date  ): ?>
                                    <button type="button" class="btn-disabled" disabled="disabled">活动还还未开始</button>
                                <?php elseif ($today >= $vote->end_date) :?>
                                    <button type="button" class="btn-disabled" disabled="disabled">活动已结束</button>
                                <?php else: ?>
                                    <?php if ( empty($isUse) ) : ?>
                                        <button type="submit">提交</button>
                                    <?php else : ?>
                                        <button type="button" class="btn-disabled" disabled="disabled">已投票</button>
                                    <?php endif; ?>
                                <?php endif; ?>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
<?php if ( $this->session->flashdata('vote') ): ?>
    <div class="vote-succeed widthMax">
        <div class="succeed-close">
            <img src="/skins/home/images/succeed-close.png" />
        </div>
        <div class="vote-thinks">
            <img class="thinks-bg" src="/skins/home/images/secceed.png" />
            <div class="content">
                <p>您将获得一次幸运大抽奖，神秘好礼转转转，赶快行动吧！</p>
            </div>
　　		<!-- <p class="register">
                <a href="<?php echo site_url('home/lottery/index').'?unfounder=' , $this->input->get('unfounder'); ?>">赶快行动吧！</a>
            </p> -->
            <div class="getcoin">
                <a href="<?php echo site_url('home/lottery/index').'?unfounder=' , $this->input->get('unfounder'); ?>">去抽奖</a>
            </div>
        </div>
        <div class="succeed-hidden"></div>
    </div>
    <script>
        $(document).ready(function(){
            var h = $(window).height();
            $(".succeed-hidden").css('height',h);
            $(".succeed-close").click( function () { $('.vote-succeed').hide(); });
            $('.succeed-hidden').click( function() { $('.vote-succeed').hide(); });
        });
    </script>
<?php endif; ?>
<?php $this->load->view('home/layout/footer'); ?>